Skip to content

feat: support 120fps for Animated#51775

Open
okwasniewski wants to merge 1 commit into
react:mainfrom
okwasniewski:feat/animated-120fps
Open

feat: support 120fps for Animated#51775
okwasniewski wants to merge 1 commit into
react:mainfrom
okwasniewski:feat/animated-120fps

Conversation

@okwasniewski

@okwasniewski okwasniewski commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

Summary:

This PR adds support for 120fps animations for the Animated API. The frame length is no longer hard coded to be 60.

ScreenRecording_06-03-2025.5-49-22.PM_1.MP4

TODO List

  • Handle JS code that hardcode 60 fps
  • Handle Android
  • Introduce a feature flag
  • Remove deadlock

Changelog:

[GENERAL] [ADDED] - support 120fps for Animated

Test Plan:

Run some animations and check their smoothness on Device (!).

@okwasniewski okwasniewski force-pushed the feat/animated-120fps branch from e368c44 to c679e4c Compare June 3, 2025 15:50
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Jun 3, 2025
@okwasniewski

Copy link
Copy Markdown
Contributor Author

cc: @cipolleschi 🙏

@cipolleschi cipolleschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this. IIRC, there is also some code in JS that hardcode 60 fps, but I don't remember where... can we make sure that all the references to 60 fps are handled?

We should also make similar changes on Android and...

...this should be behind a featureflag as it will change the behavior of the internal apps and we would like to have a quick killswitch to revert to previous behavior in case the crash rate raises.

Comment thread packages/react-native/Libraries/NativeAnimation/Drivers/RCTAnimationDriver.h Outdated
Comment thread packages/rn-tester/RNTester/Info.plist Outdated
@okwasniewski

Copy link
Copy Markdown
Contributor Author

Comment thread packages/react-native/Libraries/NativeAnimation/Drivers/RCTAnimationDriver.h Outdated
Comment thread packages/react-native/Libraries/NativeAnimation/Drivers/RCTFrameAnimation.mm Outdated
Comment thread packages/react-native/React/CoreModules/RCTPerfMonitor.mm Outdated
@salemkode

Copy link
Copy Markdown

Any updates ?

@Norcy

Norcy commented Jul 17, 2025

Copy link
Copy Markdown

bump

@okwasniewski

Copy link
Copy Markdown
Contributor Author

Sorry for no movement on this PR.. I'll try to prioritize it this week 🤞

@okwasniewski okwasniewski force-pushed the feat/animated-120fps branch 2 times, most recently from 3057571 to 82795dc Compare August 21, 2025 13:29
@YueLiXing

Copy link
Copy Markdown
image

@okwasniewski

Copy link
Copy Markdown
Contributor Author

@YueLiXing did you re-install pods?

@okwasniewski okwasniewski force-pushed the feat/animated-120fps branch 5 times, most recently from beaad00 to 9cde3b1 Compare August 24, 2025 15:56
Comment on lines 25 to 28

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cortinico @cipolleschi Can you help me understand why are there two turbo modules for animated? I found one is working only for iOS and one only for Android.. Not sure which one I should use

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use NativeAnimatedHelper for this.

@okwasniewski

Copy link
Copy Markdown
Contributor Author

@cipolleschi Should be ready to re-review. I've added Android support and feature flags

@okwasniewski okwasniewski changed the title feat: support 120fps for Animated on iOS feat: support 120fps for Animated Aug 24, 2025
Comment on lines 25 to 28

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use NativeAnimatedHelper for this.

{
if (!_displayLink && _activeAnimations.count > 0) {
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(stepAnimations:)];
_displayLink.preferredFramesPerSecond = [UIScreen mainScreen].maximumFramesPerSecond;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs the same feature flag gating


CGFloat previousScale = _scale;
CGFloat targetFps = MAX(_maxFPS, 60.0);
CGFloat screenRefreshRate = [UIScreen mainScreen].maximumFramesPerSecond;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be the current refresh rate, otherwise we. may be giving a wrong signal

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a separate PR

import android.content.Context
import android.view.WindowManager

public fun getSingleFrameInterval(context: Context): Double {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do Android in a separate PR


val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager

val refreshRate = windowManager.defaultDisplay.supportedRefreshRates.maxOrNull()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Norcy

Norcy commented Oct 30, 2025

Copy link
Copy Markdown

any update?

@thymikee

Copy link
Copy Markdown
Contributor

@okwasniewski wen pls

@react-native-bot

Copy link
Copy Markdown
Collaborator

This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@react-native-bot react-native-bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. Stale There has been a lack of activity on this issue and it may be closed soon.

Projects

None yet

Development

Successfully merging this pull request may close these issues.